package com.example.shopp_2301.minefg

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.example.base.entity.OrderEntity
import com.example.base.mvvm.BaseModel
import com.example.base.mvvm.BaseViewModel
import kotlinx.coroutines.launch

class OrderViewModel:BaseViewModel() {
    //返回值---订单列表
    val success = MutableLiveData<BaseModel<OrderEntity>>()
    val fail = MutableLiveData<String>()
    fun order(type:String,limit:Int,page:Int){
        viewModelScope.launch {
            try {
                success.value = apiServer.order(type, limit, page)
            }catch (e:Exception){
                fail.value = e.message
            }
        }
    }
}